﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data;
using System.Text;

public partial class Pages_Account_Close : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label4.Text = "";
        if (!CheckBox1.Checked)
        {
            Label4.Text = "First confirm by ticking the switch";
            return;
        }
        #region connect to database and save the account info in corresponding row of ACCOUNT table

        string conString = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;

        SqlCommand myCommInsert = new SqlCommand();
        myCommInsert.Connection = new SqlConnection(conString);
        myCommInsert.Connection.Open();

        string strQuery2 = "UPDATE account SET accclose='true'" +
                    " WHERE acctype=" + Common.accTypeValue.ToString() +
                    " and acccode=" + Common.accCodeValue.ToString();
        
        //TextBox1.Text = strQuery2;
        myCommInsert.CommandText = strQuery2;
        myCommInsert.ExecuteNonQuery();

        myCommInsert.Connection.Close();
        #endregion

    }
}
